/*
 * JPConfiguraAD.java
 *
 * Created on 12 de Setembro de 2008, 07:53
 */
package moduledefault.classify.c45.rafael.view.jpanel;

//import a_Visao.Interface.ConfiguracaoAlgoritmo;
import view.jpanel.JPanelTabbed;
//import b_Controle.FacadeSwing;
import moduledefault.classify.c45.rafael.AD;
//import c_Modelo.Classificacao.Classificacao;
//import c_Modelo.Regras.FacadeFactory;
import moduledefault.classify.c45.FacadeC45ClassifierModule;

/**
 *
 * @author  Rafael
 */
public class JPConfiguraAD /* extends ConfiguracaoAlgoritmo */ extends javax.swing.JPanel {

//    AD ad;
//    FacadeSwing facadeSwing;

    /** Creates new form JPConfiguraAD */
    public JPConfiguraAD() {
        initComponents();
//        facadeSwing = FacadeFactory.getFacadeSwing();
//        jLabelScore.setVisible(false);
//        jTextFieldScore.setVisible(false);
    }

//    @Override
//    public Classificacao getClassificacao() {
//        return ad;
//    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jLabelEntropy = new javax.swing.JLabel();
        jTextFieldEntropy = new javax.swing.JTextField();
        jLabelScore = new javax.swing.JLabel();
        jTextFieldScore = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();

        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Configuração AD", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 18))); // NOI18N

        jButton1.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jButton1.setText("Concluir");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabelEntropy.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabelEntropy.setText("Entropia");

        jTextFieldEntropy.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jTextFieldEntropy.setText(Double.toString(moduledefault.classify.c45.FacadeC45ClassifierModule.getEntropy()));

        jLabelScore.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabelScore.setText("Score");

        jTextFieldScore.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jTextFieldScore.setText(Double.toString(moduledefault.classify.c45.FacadeC45ClassifierModule.getScore()));

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Question.GIF")));
        jButton2.setToolTipText("Origem dos Dados");

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Question.GIF")));
        jButton3.setToolTipText("Origem dos Dados");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelEntropy)
                    .addComponent(jLabelScore))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jTextFieldScore, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jTextFieldEntropy, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(116, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldEntropy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabelEntropy))
                    .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelScore)
                    .addComponent(jTextFieldScore, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(19, 19, 19)
                .addComponent(jButton1)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
//    double entropia = Double.parseDouble(jTextFieldEntropy.getText());
//    double score = Double.parseDouble(jTextFieldScore.getText());
//    ad = new AD(facadeSwing.getPrevia().getRafaelJTable1().getColumnIdentifiers(), entropia, score, jRHoldOut.isSelected());
//
//    //Incluido POR EVARISTO somente para adequação
//    double mi[][] = new double[facadeSwing.getInput().length][facadeSwing.getInput()[0].length];
//    for(int i =0;i<facadeSwing.getInput().length;i++)
//        for(int j=0;j<facadeSwing.getInput()[0].length;j++)
//            mi[i][j] = Double.parseDouble(facadeSwing.getInput()[i][j].toString());
//
//
//    double mo[][] = new double[facadeSwing.getInput().length][0];
//    for(int i =0;i<facadeSwing.getOutput().length;i++)
//            mo[i][0] = Double.parseDouble(facadeSwing.getInput()[i].toString());
//
//    long tempoinicial = System.currentTimeMillis();
//
//    ad.treinar(mi, mo);
//    //ad.treinar(facadeSwing.getInput(), facadeSwing.getOutput());
//    //FIM alteração
//
//    long tempofinal = System.currentTimeMillis();
//    long tempo = tempofinal - tempoinicial;
//
//    System.out.println(util.Util.getHoraMinSegMiliSeg(tempo));
//
//    facadeSwing.inicializaInterface();
//    facadeSwing.setEnabledAtJPAbas(JPanelTabbed.jPTeste, true);
//    facadeSwing.setEnabledAtJPAbas(JPanelTabbed.jPEstatisticas, true);
//    facadeSwing.setEnabledAtJPAbas(JPanelTabbed.jPResultadoAlgoritmo, true);
//    facadeSwing.setEnabledAtJPAbas(JPanelTabbed.jPTeste, true);
//    facadeSwing.setSelectedIndex(JPanelTabbed.jPResultadoAlgoritmo);
//    facadeSwing.getJPEstatisticas().setTempo(util.Util.getHoraMinSegMiliSeg(tempo));

    FacadeC45ClassifierModule.setEntropy(Double.parseDouble(jTextFieldEntropy.getText()));
    FacadeC45ClassifierModule.setScore(Double.parseDouble(jTextFieldScore.getText()));
    FacadeC45ClassifierModule.getJDialogConfig().dispose();
}//GEN-LAST:event_jButton1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabelEntropy;
    private javax.swing.JLabel jLabelScore;
    private javax.swing.JTextField jTextFieldEntropy;
    private javax.swing.JTextField jTextFieldScore;
    // End of variables declaration//GEN-END:variables
//
//    @Override
//    public void setClassificacao(Classificacao classificador) {
//        ad = (AD) classificador;
//    }
}
